from rest_framework import serializers
from .models import GuitarTab, GuitarTabImage


class GuitarTabImageSerializer(serializers.ModelSerializer):
    class Meta:
        model = GuitarTabImage
        fields = ['id', 'save_path', 'save_name', 'index', 'scroll_speed', 'rollback_to', 'rollback_times']


class GuitarTabSerializer(serializers.ModelSerializer):
    images = GuitarTabImageSerializer(many=True, read_only=True)

    class Meta:
        model = GuitarTab
        fields = ['id', 'name', 'author', 'type', 'create_time', 'cover_path', 'images']
